home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 11 / Cream of the Crop 11-1.iso / games / nerak2.zip / ARK6.SCR < prev    next >
Text File  |  1994-05-01  |  13KB  |  389 lines

  1. !
  2. ! Default script ARK.SCR.
  3. !
  4. ! This is the default script for handling objects.  It is invoked whenever
  5. ! an object is manipulated (Talk, Get, Drop, Wear, Remove, Look, Examine,
  6. ! Invoke, Use and Exit) under the following conditions:
  7. !
  8. ! a) If the object has a script assigned to it, that script is invoked
  9. !    first.
  10. ! b) If the object's script terminates with CONTINUE, or if the object
  11. !    does not have a script, then this script is invoked.
  12. !
  13. ! You may modify this script at will, but one thing to remember is that
  14. ! this script should NEVER terminate with CONTINUE.  The reason is that
  15. ! objects may explicitly state that their script is 'OBJECT', in which
  16. ! case a 'CONTINUE' would execute this script twice! (Once as the script
  17. ! assigned to the object, and another time because the script ended with
  18. ! continue).
  19. !
  20. ! (c) DC Software, 1992
  21. !
  22.  
  23. !------------------------------------------------------------------------!
  24. :@TALK ! Talk to the object or npc !
  25. !------------------------------------------------------------------------!
  26.   ! This script is called whenever the object or NPC you tried to talk
  27.   ! to does not have it's own script for handling talking. Thus, it just
  28.   ! prints a standard message.  Since nothing really happens here, we
  29.   ! omit the check to see if the player is alive.
  30.  
  31.   ! gosub STILLKICKING; - don't check !
  32.   if npc.count then
  33.     writeln( "The ", npc.type, " has nothing to say.." );
  34.   else
  35.     writeln( "How do you talk to an ", object.type, "?" );
  36.   endif;
  37.   STOP;
  38.  
  39. !------------------------------------------------------------------------!
  40. :@GET ! Get the object (pick it up) !
  41. !------------------------------------------------------------------------!
  42.    writeln( "You can't get the Ark!" ); 
  43.    STOP;
  44.  
  45. !------------------------------------------------------------------------!
  46. :@LOOK      ! Look at an object                                          !
  47. !------------------------------------------------------------------------!
  48.   L(255) = True;   ! give DETAILED description !
  49.   gosub DESCRIBE;
  50.   STOP;
  51.  
  52. !------------------------------------------------------------------------!
  53. :@EXAMINE   ! Examine the object in detail                               !
  54. !------------------------------------------------------------------------!
  55.   L(255) = TRUE;   ! Give DETAILED description !
  56.   gosub DESCRIBE;
  57.   STOP;
  58.    
  59.  
  60. !------------------------------------------------------------------------!
  61. :@USE ! Use an object laying on the ground before us..
  62. !------------------------------------------------------------------------!
  63. !
  64. ! Called when an object that is laying on the ground is 'used'.  Note that
  65. ! 'use' means different things for different object types, and that in 
  66. ! order to invoke an item you have 'get' it and sometimes 'wear' it.
  67. !
  68.   if object.endgame = END_ON_USE then
  69.     if object.endtext > 0 then         ! .. this text is displayed first.. !
  70.       readtext( object.endtext );
  71.     endif;                             ! .. then the game ends. !
  72.     ENDGAME;
  73.   endif;
  74.  
  75.   on object.type goto
  76.    USE_FOOD,     USE_WEAPON,     USE_AMMO,      USE_ARMOR,      USE_SHIELD,
  77.    USE_AMULET,   USE_RING,       USE_POTION,    USE_SCROLL,     USE_STAFF,
  78.    USE_CHEST,    USE_KEYS,       USE_GEMS,      USE_BOOK,       USE_GOLDSACK,
  79.    USE_TORCH,    USE_LANTERN,    USE_ROPE,      USE_HOOKS,      USE_MIRROR,
  80.    USE_SIGN,     USE_VEHICLE;
  81.  
  82.   writeln( "I don't know how to do that with the ", object.name );
  83.   STOP;
  84.  
  85.   :USE_FOOD
  86.   :USE_POTION
  87.      if object.class then
  88.        writeln( "You must 'get' it, then 'quaff' (eat) it.." );
  89.      else
  90.        writeln( "Just 'get' it.." );
  91.      endif;
  92.      STOP;
  93.  
  94.   :USE_GEMS
  95.   :USE_SCROLL
  96.      writeln( "You must first 'get' it, then 'invoke' it.." );
  97.      STOP;
  98.  
  99.   :USE_AMULET
  100.   :USE_RING
  101.   :USE_ARMOR
  102.   :USE_WEAPON
  103.   :USE_SHIELD
  104.   :USE_STAFF
  105.      writeln( "You must first 'get' it, then 'wear' or 'wield' it.." );
  106.      STOP;
  107.  
  108.   :USE_AMMO
  109.      writeln( "Just carry it in your backpack.  If you 'wield' a " );
  110.      writeln( "weapon that uses this type of ammo, it will get used" );
  111.      writeln( "automaticly." );
  112.      STOP;
  113.  
  114.   :USE_CHEST
  115.      ! Unlock the chest !
  116.      if object.locktype then
  117.        L(0) = 0;
  118.        :UCLOOP
  119.           setbp( player, L(0) );
  120.           if player.bp.type = KEYS and player.bp.keytype = object.locktype then
  121.             writeln( object.name, " unlocked.." );
  122.             object.locktype = 0;
  123.             STOP;
  124.           endif;
  125.           inc( L(0) );
  126.           if L(0) < 16 goto :UCLOOP;
  127.        writeln( "You don't have the right key!  Break the lock?" );
  128.        if getstr( "Yes", "No" ) = 0 then
  129.          if random( 2 + adjustments(player.str) ) > 0 then
  130.            write( "You broke the lock!" );
  131.            if object.traptype = 1 then
  132.              voice( "Argh", 1000 ); ! 1000 = DCSOUNDS.VFL !
  133.              writeln( "Argh.. Poison trap!" );
  134.              player.poisoned = 1;
  135.            elsif object.traptype > 1 then
  136.              voice( "Explode", 1000 ); ! Play standard sound effect !
  137.              writeln( "Bomb Trap!" );
  138.              dec( player.hp, object.damage );
  139.              if player.hp = 0 then
  140.                writeln( player.name, " has died.." );
  141.              endif;
  142.            endif;
  143.            object.locktype = 0;
  144.          else
  145.            writeln( "It doesn't break!" );
  146.          endif;
  147.        else
  148.           writeln( "Ok." );
  149.        endif;
  150.      else
  151.        writeln( "It is not locked.." );
  152.      endif;
  153.      STOP;
  154.  
  155.   :USE_KEYS
  156.      writeln( "Just 'Get' it and carry it in case you find a lock that" );
  157.      writeln( "the key can open!" );
  158.      STOP;
  159.  
  160.   :USE_BOOK
  161.      writeln( "To read it, just 'Look' at it.." );
  162.      STOP;
  163.  
  164.   :USE_GOLDSACK
  165.      L(1) = getnum("How many gold pieces do you want to put in it?",
  166.                          0, group.gold / 10) * 10;
  167.      if L(1) then
  168.        writeln( "You put ", $L1, " in the bag." );
  169.        inc( object.value, L(1) );
  170.        dec( group.gold, L(1) );
  171.      else
  172.        writeln( "Smart move.." );
  173.      endif;
  174.      STOP;
  175.  
  176.   :USE_TORCH
  177.   :USE_LANTERN
  178.      writeln( "Save your torches.. I haven't implemented LIGHT yet!" );
  179.      STOP;
  180.  
  181.   :USE_ROPE
  182.      writeln( "After fooling around with it for a while, you manage to" );
  183.      writeln( "get yourself tangled up..." );
  184.      STOP;
  185.  
  186.   :USE_HOOKS
  187.      voice( "Ouch", 1000 );
  188.      writeln( "Ouch! (it's sharp!)" );
  189.      STOP;
  190.  
  191.   :USE_MIRROR
  192.      writeln( "Yes, you are ugly, but that doesn't matter here.." );
  193.      STOP;
  194.  
  195.   :USE_SIGN
  196.      writeln( "It's not yours.  You can 'Read' it if you wish.." );
  197.      STOP;
  198.  
  199.   :USE_VEHICLE
  200.      if group.vehicle.count then
  201.        writeln( "You cannot use the ark!  It's no longer seaworthy!" );
  202.        writeln( "It would sink in seconds!" );
  203.      STOP;
  204.      endif;
  205.      if object.x <> group.x and object.y <> group.y then
  206.        writeln( "You cannot use the ark!  It's no longer seaworthy! " );
  207.       endif;
  208.     STOP;
  209.  
  210.  
  211. !------------------------------------------------------------------------!
  212. :@ATTACK ! Attack an object or a person !
  213. !------------------------------------------------------------------------!
  214.   if npc.count then
  215.     if npc.type = HOSTILE then
  216.       FIGHT;
  217.       !- Script ends when you 'FIGHT' -!
  218.     endif;
  219.     writeln( "How DARE you try and fight such a noble ship!  Find some bad guys to fight!" );
  220.     STOP;
  221.   endif;
  222.   if object.type = CHEST then
  223.     if object.locktype then
  224.       writeln( "Instead of fighting it, try 'UNLOCK'!" );
  225.     else
  226.       writeln( "It's not even locked, why fight it?" );
  227.     endif;
  228.   else
  229.     writeln( "Why would you want to fight the ", object.name );
  230.   endif;
  231.   STOP;
  232.  
  233. !------------------------------------------------------------------------!
  234. !--  SCRIPT SUBROUTINES ARE GROUPED HERE AT THE END.  THIS IS A CHOICE --!
  235. !--  NOT A REQUIREMENT.  IT MAKES THE MAIN SCRIPT CODE ABOVE A LITTLE  --!
  236. !--  BIT EASIER TO FOLLOW.  ---------------------------------------------!
  237. !------------------------------------------------------------------------!
  238.  
  239.  
  240. !------------------------------------------------------------------------!
  241. ! STILLKICKING: Subroutine to verify that the player is alive before     !
  242. ! allowing him/her/it to perform an action.                              !
  243. !------------------------------------------------------------------------!
  244. :STILLKICKING
  245.   if player.hp = 0 then
  246.     writeln( player.name, " is dead!" );
  247.     STOP;
  248.   endif;
  249.   RETURN;
  250.  
  251. !------------------------------------------------------------------------!
  252. !
  253. ! SUBROUTINE: DESCRIBE
  254. !
  255. ! This routine is invoked from @LOOK, @EXAMINE and by the ANALYZE spell
  256. ! to describe a given item.
  257. !
  258. !------------------------------------------------------------------------!
  259. :DESCRIBE
  260. !------------------------------------------------------------------------!
  261.  
  262. ! First, handle the case where you are looking at a CHARACTER
  263.  
  264.   if npc.count then
  265.     if npc.picture >= 0 then
  266.       viewpcx( npc );
  267.       if success then
  268.         pause;
  269.       endif;
  270.       paint(window); ! Assumes the picture fits in the window !
  271.     endif;
  272.     write( " " );
  273.     if npc.type = HOSTILE and npc.weapon.count then
  274.       write( ", Weapon: ", npc.weapon.name, ", Damage: ", npc.weapon.damage, ", Range: ", npc.weapon.range );
  275.     endif;
  276.     if L(255) then
  277.       write( ", Class: ", npc.class, ", Lvl: ", npc.level, ", AC: ", npc.ac, ", HP: ", npc.hp );
  278.     endif;
  279.     writeln(".");
  280.     STOP;
  281.   endif;
  282.   if object.picture >= 0 then
  283.     viewpcx( object );
  284.     if success then
  285.       pause;
  286.     endif;
  287.     paint(window); ! Assumes the picture fits in the window !
  288.   elsif object.type = SIGN or object.type = BOOK then
  289.     readtext( object.text );
  290.     STOP;
  291.   endif;
  292.   write( " " );
  293.   if NOT L(255) then
  294.     writeln;
  295.     STOP;
  296.   endif;
  297.   write( " " );
  298. !
  299. ! The following is a 'cascading if..then..elsif..elsif.....else..endif' 
  300. ! statement.  It is used here to illustrate it's usefulness.  The same
  301. ! code could have been written with a 'ON object.type GOTO' statement.
  302. !
  303.   if object.type = FOOD or object.type = POTION  then
  304.     if object.class then
  305.       write( ", Class: ", object.class );
  306.       if object.class <> CURE then
  307.         write( ", Units: ", object.units );
  308.       endif;
  309.     endif;
  310.   elsif object.type = WEAPON then
  311.     write( ", Class: ", object.class, 
  312.            ", Hands: ", object.hands, 
  313.            ", Range: ", object.range, 
  314.            ", Damage: ", object.damage );
  315.     if object.ammoneeded then
  316.       write( ", Needs ammo type: ", object.ammo_type );
  317.     endif;
  318.   elsif object.type = AMMO then
  319.     write( ", Ammo Type: ", object.ammotype );
  320.     if object.traptype then
  321.       write( ", Poisoned" );
  322.     endif;
  323.     if object.damage then
  324.       write( ", Extra Damage: ", object.damage );
  325.     endif;
  326.   elsif object.type = ARMOR or object.type = SHIELD then
  327.     write( ", Armor Class: ", object.ac );
  328.     if object.cursed then
  329.       write( " Cursed!" );
  330.     endif;
  331.   elsif object.type = AMULET or object.type = RING or object.type = GEMS then
  332.     if object.class then
  333.       write( ", Class: ", object.class );
  334.       write( ", Charges: ", object.charges );
  335.       if object.class <> CURE then
  336.         write( ", Units: ", object.units );
  337.         if object.permanent then
  338.           write( ", Permanent!" );
  339.         else
  340.           write( ", Temporary" );
  341.         endif;
  342.       endif;
  343.       if object.cursed then
  344.         write( ", Cursed!" );
  345.       endif;
  346.     endif;
  347.   elsif object.type = SCROLL then
  348.     write( ", Class: ", object.class );
  349.   elsif object.type = STAFF then
  350.     write( ", Class: ", object.class, ", Charges: ", object.charges );
  351.   elsif object.type = CHEST then
  352.     if object.locktype then
  353.       write( ", Locked!" );
  354.       if object.traptype = 0 then
  355.         write( ", no traps" );
  356.       elsif object.traptype = 1 then
  357.         write( ", poison trap" );
  358.       else
  359.         write( ", bomb damage: ", object.traptype );
  360.       endif;
  361.     endif;
  362. ! elsif object.type = KEYS     then
  363. !   nothing special about it
  364. ! elsif object.type = BOOK     then
  365. !   nothing special about it
  366. ! elsif object.type = GOLDSACK then
  367. !   nothing special about it
  368. ! elsif object.type = TORCH    then
  369. !   nothing special about it
  370. ! elsif object.type = LANTERN  then
  371. !   nothing special about it
  372. ! elsif object.type = ROPE     then
  373. !   nothing special about it
  374. ! elsif object.type = HOOKS    then
  375. !   nothing special about it
  376. ! elsif object.type = MIRROR   then
  377. !   nothing special about it
  378. ! elsif object.type = SIGN     then
  379. !   nothing special about it
  380.   elsif object.type = VEHICLE then
  381.     write( "It's Noah's Ark!!!!!     You found it!!!!!!! " );
  382.     write( "Now you'll be rich and famous!!!!!!! " );
  383.     write( "NOT!!!!! " );
  384. ! else
  385. ENDIF;
  386. !   user defined type?
  387. return;
  388.  
  389.